<?php
/**
 * @package WordPress
 * @subpackage WelCare
 */
get_header();

/** blog settings from option  */ ?>

<div class="container">

	<!-- Page Banner-->
	<?php fw_subpages_banner('single');?>
	
	<!-- Breadcrumbs-->
	<div class="breadcrumbs">
		<?php echo get_the_breadcrumb(); /** add breadcrumbs */ ?>
	</div>
      <?php $sidebar = get_post_meta($queried_obj->ID, 'wl_custom_sidebar', true); 
		//echo $sidebar ; exit ; 
	$contents_area = ( $sidebar != -1) ? 'contents_area' : '';
	$contents = ( $sidebar != -1) ? 'contents' : '';
	?>
	
	<!-- Content Area-->
<div id="<?php echo $contents_area; ?>">
		<div class="<?php echo $contents; ?>">
	
			<?php if (have_posts()) : /** start our loop  */ ?>
			<?php while (have_posts()) : the_post();?>
			<article class="block">
				<div class="head_section">
					<div class="post_date">
						<div class="day_month">
							<span class="day"><?php the_time('d');?></span>
							<span class="month"><?php the_time('M');?></span>
						</div>

						<span class="post_year"><?php the_time('Y');?></span>
					</div>
					
					<h1><?php the_title();?></h1>
					
					<div class="contact_bar">
						<ul>
							<li class="first-child">
								<a class="doctor_icon" href="<?php echo HOME_URL?>?author=<?php the_author_meta( 'ID' );?>"><?php the_author();?></a>
							</li>
							
							<li class="comments_icon">
								<?php comments_popup_link( __('No Comment', THEME_NAME), __('1 Comment', THEME_NAME), __('% Comments', THEME_NAME));?>
							</li>
							
							<li class="iphone_articles articles_icon"><?php the_category(', ');?></li>
						</ul>
					</div>
				</div>
				
				<?php /** get post image id */ ?>
				<?php if(has_post_thumbnail()) the_post_thumbnail('single-image', array('class'=>'frame'));?>
				<div class="details">
					<?php the_content();?>
					<?php wp_link_pages('before=<div class="paginate"><span class="page_numbering">'.__('Pages:', THEME_NAME).'</span>&after=</div>');?>
				</div>
			</article>
			
			<?php endwhile;?>
			
			<!--Comments-->
			<?php comments_template('', true); /** print comments and comment form */?>
			
			<?php endif; ?>
		</div>
	</div>
	   <?php if( $sidebar != -1): ?>
	<!-- Sidebar -->
	<div id="side_bar">
		<?php
			if($sidebar = get_post_meta($post->ID, 'wl_custom_sidebar', true)) dynamic_sidebar($sidebar);
			else _load_dynamic_sidebar('single');?>
	</div>
      <?php endif; ?>
</div>

<?php get_footer();?>